//
// Created by de on 4/6/21.
//

#include <gtest/gtest.h>
#include <SqlController/dao/SqlSqliteDao.h>
#include "TStateController.h"
using namespace HsState;
//class TStateTest: public ::testing::Test {
//protected:
//    virtual ~TStateTest() {
//        // You can do clean-up work that doesn't throw exceptions here.
//    }
//
//    // If the constructor and destructor are not enough for setting up
//    // and cleaning up each test, you can define the following methods:
//    virtual void SetUp() {
//        // Code here will be called immediately after the constructor (right
//        // before each test).
//        p_controller.initDevice();
//        p_controller.runningThreading();
//    }
//
//    virtual void TearDown() {
//        // Code here will be called immediately after each test (right
//        // before the destructor).
//    }
//
//    // Objects declared here can be used by all tests in the test case for Project1.
//    TStateController p_controller;
//    SqlSqliteDao my;
//
//public:
//    TStateTest() {
//        // You can do set-up work for each test here.
//    }
//
//};
//TEST_F(TStateTest, WaitLoop) {
//
//    for(int i = 0;i < 5;i++)
//    {
//        WorkResult result = p_controller.getWorkResult();
//        spdlog::info(result.to_string());
//    }
//
//
//    p_controller.stopDevice();
//}
//
//
//TEST_F(TStateTest, TestLog) {
//
//    for(int i = 0;i < 5;i++)
//    {
//        spdlog::info("--------------------");
//    }
//}

int main(int argc, char* argv[])
{
//    ::testing::InitGoogleTest(&argc, argv);
    ros::init(argc, argv, "ForceMeasure");
    ros::NodeHandle p_node;
    ros::AsyncSpinner as(1);
    as.start();
    std::this_thread::sleep_for(std::chrono::seconds(1));


    TStateController p_controller(&p_node);
    SqlSqliteDao my;
    p_controller.initDevice();
    p_controller.runningThreading();
    std::this_thread::sleep_for(std::chrono::milliseconds(500));

    for(int i = 0;i < 1;i++)
    {
        spdlog::info("当前运行次数 "+std::to_string(i));
        p_controller.RunSignalAction();

        WorkResult result = p_controller.getWorkResult();
//        my.insertObject(result);
//        spdlog::info(result.to_string());
    }
    p_controller.stopDevice();

//    RosHandler rosHandler(&p_node);
//    rosHandler.sendDeviceReset();
//    const ForceStateData &data = rosHandler.getDeviceControlStateStatus();

    return 0;

}